package com.itany.corejava.code17_设计模式.模板模式;

import java.util.Arrays;

/**
 * @author MissChen
 * @date 2024年03月27日 11:18
 */
public class Test {
    public static void main(String[] args) {
        Integer[] arr={12,34,89,9,22,1,90,7};
        SortTemplate.sort(arr, new SortComparator<Integer>() {
            @Override
            public int compareTo(Integer t1, Integer t2) {
                return t1-t2;
            }
        });
        System.out.println(Arrays.toString(arr));

        String[] arr2={"jack","alice","angelababy","smith","A"};
        SortTemplate.sort(arr2, new SortComparator<String>() {
            @Override
            public int compareTo(String t1, String t2) {
                return t2.length()-t1.length();
            }
        });
        System.out.println(Arrays.toString(arr2));
    }
}
